<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

    <title>微信支付</title>
    <script type="application/javascript" src="__STATIC__/jquery/jquery-3.1.1.min.js"></script>

    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                    "getBrandWCPayRequest",
                    {$jsApiParameters},
                    function(res){
                        WeixinJSBridge.log(res.err_msg);
                        if(res.err_msg == 'get_brand_wcpay_request:ok'){
                            $('#success').show();
                            $('#order').hide();
                        }
                    }
            );
        }

        function callpay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener("WeixinJSBridgeReady", jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent("WeixinJSBridgeReady", jsApiCall);
                    document.attachEvent("onWeixinJSBridgeReady", jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }
    </script>
    <link href="https://res.wx.qq.com/open/libs/weui/1.0.2/weui.min.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="success" class="weui-msg" style="display:none;">
    <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
    <div class="weui-msg__text-area">
        <h2 class="weui-msg__title">支付成功</h2>
        <!--<p class="weui-msg__desc">内容详情，可根据实际需要安排，如果换行则不超过规定长度，居中展现<a href="javascript:void(0);">文字链接</a></p>-->
    </div>
    <div class="weui-msg__opr-area">
        <p class="weui-btn-area">
            <a href="{:U('Order/detail',array('id'=>$order['id']))}" class="weui-btn weui-btn_primary">确定</a>
        </p>
    </div>
    <div class="weui-msg__extra-area">
        <div class="weui-footer">
            <p class="weui-footer__links">
                <a href="http://www.huiyouzan.com" class="weui-footer__link">技术支持：汇友科技</a>
            </p>
            <!--<p class="weui-footer__text">Copyright &copy; 2008-2016 weui.io</p>-->
        </div>
    </div>
</div>

<div class="weui-form-preview" id="order">
    <div class="weui-form-preview__hd">
        <label class="weui-form-preview__label">总金额</label>
        <em class="weui-form-preview__value">¥{$order.total_price}</em>
    </div>
    <div class="weui-form-preview__bd">
        <volist name="order['cartdata']['item']" id="item">
            <p>
                <label class="weui-form-preview__label">{$item.title}</label>
                <span class="weui-form-preview__value">{$item.number} ×</span>
                <span class="weui-form-preview__value">￥{$item.price}</span>
            </p>
        </volist>
    </div>
    <div class="weui-form-preview__ft">
        <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="javascript:" onclick="callpay()">立即支付</a>
    </div>
</div>

</body>
</html>
